package pkg1.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import pkg1.entity.User;
import pkg1.mapper.UserMapper;

@Service
public class UserServiceImp implements UserServiceInter {
	@Autowired
	private UserMapper userDao;

	@Override
	public boolean checkUsername(String username) {
		int count = userDao.checkUsername(username);
		if (count > 0) {
			return true;
		} else {
			return false;
		}
	}

	@Override
	public boolean doSignup(User user) {
		int count = userDao.insert(user);
		if (count > 0) {
			return true;
		} else {
			return false;
		}
	}

	@Override
	public boolean doLogin(String username, String password) {
		int count = userDao.doLogin(username,password);
		if (count > 0) {
			return true;
		} else {
			return false;
		}
	}

}
